﻿using System.ComponentModel;
using System.Windows.Data;
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.Prism.Regions;
using Tanmia.Basis.ViewInterface;
using Tanmia.Basis.ViewModel;
using Tanmia.Warehouse.Core;
using Tanmia.Warehouse.Domain;

namespace Tanmia.Warehouse.Presentation.Scenarios
{
    [ViewInfo("تحرير الأقسام", "المستودعات تتواجد ضمن الفروع, الموزع جغرافياً.", Constants.RegionEditor, Views.SectionEditor)]
    public class SectionEditorViewModel : EditorViewModel<Section>
    {
        protected BranchDomain BranchObj { get; set; }
        public ICollectionView Branchs { get; protected set; }
        public ICollectionView SectionTypes { get; protected set; }

        public SectionEditorViewModel(IShellView shellView, IRegionManager regionManager, IEventAggregator eventAggregator, IBusinessEntityNavigator<Section> entityNavigator, IMessageService messageService,
            SectionDomain sectionObj, BranchDomain branchObj, SectionTypeDomain sectionTypeObj)
            : base(shellView, regionManager, eventAggregator, entityNavigator, messageService, sectionObj)
        {
            this.BranchObj = branchObj;
            EntityName = "Section";

            Branchs = CollectionViewSource.GetDefaultView(branchObj.Gets());
            SectionTypes = CollectionViewSource.GetDefaultView(sectionTypeObj.Gets());
        }
    }
}
